import {MOUSE_MOVE_EVENT} from '@/utils/event'

export default function watchMouseMove() {
  window.ipcRenderer.on(MOUSE_MOVE_EVENT, (event, args) => {
    const {x, y} = args
    const evObj = new Event('pointermove', {bubbles: true, cancelable: false})
    Object.assign(evObj, {
      clientX: x - window.screenLeft,
      clientY: y - window.screenTop,
    })

    window.document.dispatchEvent(evObj)
  })
}